package es.albarregas.ajax;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Collection;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import es.albarregas.modelo.ModelFacade;
import es.albarregas.pojo.LineaPedido;
import es.albarregas.pojo.Provincia;

/**
 * Servlet implementation class EliminarLineaPedido
 */

public class EliminarLineaPedido extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public EliminarLineaPedido() {
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		doPost(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		
		String numeroPedido=request.getParameter("numeroPedido");
		String numeroLinea=request.getParameter("numeroLinea");
		
		response.setContentType("text/html;charset=UTF-8");
			
		
		ModelFacade.borrarLineaPedido(" where numeroPedido="+numeroPedido+" and numeroLinea="+numeroLinea);
		
		PrintWriter out = response.getWriter();		
		try {			
			out.print("Linea eliminada");
		} finally {
			out.close();
		}

	}

}
